package sf.md.create.builder;



import sf.md.create.builder.interfaces.MealManger;

import java.util.List;

public class MealBuilerHander implements MealManger {

   public  Meal meal ;

    public MealBuilerHander(String mealName){
         meal = new Meal(mealName);

    }
    @Override
    public Meal build(Item item) {
        meal.list.add(item);

        return meal;
    }

    @Override
    public String outInfo(Meal meal) {
         List<Item> list = meal.getList();
         StringBuilder stringBuilder = new StringBuilder();
         stringBuilder.append("菜单信息");

         for(Item item: list){
           stringBuilder.append(item.getName());

         }

         return  stringBuilder.toString();

    }

    @Override
    public Meal getMeal() {
        return meal;
    }
}
